//
//  SYGoodProductCVCell.m
//  TermOfSectionB
//
//  Created by 韩震明 on 15/11/30.
//  Copyright © 2015年 韩震明. All rights reserved.
//

#import "SYGoodProductCVCell.h"

@implementation SYGoodProductCVCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createCell];
    }
    return self;
}

- (void)createCell
{
    self.topImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, 3 * self.contentView.frame.size.height / 4)];
    [self.contentView addSubview:self.topImageView];
    
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 3 * self.contentView.frame.size.height / 4, self.contentView.frame.size.width, self.contentView.frame.size.height / 10)];
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.titleLabel.font = [UIFont systemFontOfSize:13.0];
    
    self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 6 * self.contentView.frame.size.height / 7, self.contentView.frame.size.width, self.contentView.frame.size.height / 10)];
    [self.contentView addSubview:self.priceLabel];
    self.priceLabel.font = [UIFont systemFontOfSize:13.0];
    self.priceLabel.textAlignment = NSTextAlignmentCenter;
    self.priceLabel.textColor = [UIColor redColor];
}

- (void)layoutSubviews
{
    [self.topImageView sd_setImageWithURL:[NSURL URLWithString:[self.productModel pic]] placeholderImage:[UIImage imageNamed:@"back.gif"]];
    self.priceLabel.text = [self.productModel price];
    self.titleLabel.text = [self.productModel title];
}

@end
